package com.test.web.controller;

import com.test.web.entity.TUser;
import com.test.web.mapper.UserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Author lhc
 * @Date 2021/10/8 10:06
 */
@RestController
@RequestMapping("/user")
public class UserController {
    @Autowired
    private UserMapper userMapper;

    @GetMapping("/add")
    public List<TUser> findAll() {
        for (int i = 1; i <= 15; i++) {
            TUser TUser = new TUser();
            TUser.setUsername("user");
            TUser.setUstatus("onLine");
            TUser.setUage(String.valueOf(i));
            userMapper.insert(TUser);
        }
        return userMapper.selectAll();
    }
}